clear all	
version 14

*******************************************************************************************************
*******************************************************************************************************
*** Title: Can you spot a scam? Measuring and Improving Scam Identification Ability
*** Authors: Jana Cahlikova, Lucy Kaaria, Elif Kubilay, Eva Raiber, and Lisa Spantig

*** Notes: This do-file replicates the figures in the main text and the appendix. 
*******************************************************************************************************
*******************************************************************************************************

******************************************************************************************************
**List of Figures 
*******************************************************************************************************
*1) FIGURE 2: Treatment Effect Heterogeneity

	*a) Panel 1: Scam Identification Ability (SIA)
	*b) Panel 2: Confidence

*2) FIGURE 3: Vignette-level effects by whether the message contains a scam marker
	
*3) FIGURE A2: SIA and Confidence in Block 1

	*a) Panel 1: Distribution of scam identification ability (SIA)
	*b) Panel 2: Distribution of Confidence in SIA

*4) FIGURE D1: Vignette-level effects by whether the message contains a scam marker

*5) FIGURE D2: Vignette-level effects by difficulty of the vignette


***************************************************************************************
*Import data
use "$datapath/online_survey_analysis", clear

set scheme lean2
***************************************************************************************
*Define and label additional controls
gen median_age = (Age > 28)

*******************************************************************
*******************************************************************
* FIGURE 2:Treatment Effect Heterogeneity
*******************************************************************
*******************************************************************

*************************************************
**Panel 1: Scam Identification Ability (SIA)***
*************************************************

foreach x in Female median_age PostSecondaryEducation LowIncome Urban DFS_diverse ScamExp_8   {
*sia
eststo `x'1: reg SIA_share_Part2 i.Treatment SIA_share_Part1 ///
	$design_controls $indiv_char $dfsuse_controls $scamexp_controls ///
	if `x'==1, vce(hc3) 
eststo `x'2: reg SIA_share_Part2 i.Treatment SIA_share_Part1 ///
	$design_controls $indiv_char $dfsuse_controls $scamexp_controls ///
	if `x'==0, vce(hc3) 
	
	
/*	
eststo `x'3: reg scam_incorrect_share_Part2 i.Treatment scam_incorrect_share_Part1 ///
	$design_controls $indiv_char $dfsuse_controls $scamexp_controls ///
	if `x'==1, vce(hc3) 
eststo `x'4: reg scam_incorrect_share_Part2 i.Treatment scam_incorrect_share_Part1 ///
	$design_controls $indiv_char $dfsuse_controls $scamexp_controls ///
	if `x'==0, vce(hc3) 
	

eststo `x'5: reg official_incorrect_share_Part2 i.Treatment official_incorrect_share_Part1 ///
	$design_controls $indiv_char $dfsuse_controls $scamexp_controls ///
	if `x'==1, vce(hc3) 	
eststo `x'6: reg official_incorrect_share_Part2 i.Treatment official_incorrect_share_Part1 ///
	$design_controls $indiv_char $dfsuse_controls $scamexp_controls ///
	if `x'==0, vce(hc3) 	
*/
	
eststo `x'7: reg SIA_confidence_Part2 i.Treatment SIA_confidence_Part1  ///
	$design_controls $indiv_char $dfsuse_controls $scamexp_controls ///
	if `x'==1, vce(hc3) 
eststo `x'8 :reg SIA_confidence_Part2 i.Treatment SIA_confidence_Part1  ///
	$design_controls $indiv_char $dfsuse_controls $scamexp_controls ///
	if `x'==0, vce(hc3) 


}

coefplot (Female1, msymbol(o) ciopts(recast(. rcap) color(maroon maroon))  mcolor(maroon) mlabels(1.Treatment= 0.5 "Women" 3.Treatment= 0.5 "Women") mlabcolor(maroon)) ///
		(Female2, msymbol(o) ciopts(recast(. rcap) color(navy navy)) mcolor(navy) mlabcolor(navy) mlabels(1.Treatment= 0.5 "Men" 3.Treatment= 0.5 "Men")), bylabel("Gender") ||   /// 
		(median_age1, msymbol(o) ciopts(recast(. rcap) color(maroon maroon)) mcolor(maroon) mlabels(1.Treatment= 0.5 "Above median (29+)" 3.Treatment= 0.5 "Above median (29+)") mlabcolor(maroon)) ///
		(median_age2, msymbol(o) ciopts(recast(. rcap) color(navy navy)) mcolor(navy) mlabels(1.Treatment= 0.5 "Below median (<29)" 3.Treatment= 0.5 "Below median (<29)")), bylabel("Age") || ///
		(PostSecondaryEducation1, msymbol(o) ciopts(recast(. rcap) color(maroon maroon)) mcolor(maroon) mlabels(1.Treatment= 0.5 "Post-secondary Education" 3.Treatment= 0.5 "Post-secondary Education") mlabcolor(maroon)) ///
		(PostSecondaryEducation2, msymbol(o) ciopts(recast(. rcap) color(navy navy)) mcolor(navy) mlabcolor(navy) mlabels(1.Treatment= 0.5 "Secondary or less" 3.Treatment= 0.5 "Secondary or less")) , bylabel("Education") || ///
		(LowIncome1, msymbol(o) ciopts(recast(. rcap) color(maroon maroon)) mcolor(maroon) mlabels(1.Treatment= 0.5 "Low Income" 3.Treatment= 0.5 "Low Income") mlabcolor(maroon) legend(off) ) ///
		(LowIncome2, msymbol(o) ciopts(recast(. rcap) color(navy navy)) mcolor(navy) mlabcolor(navy) mlabels(1.Treatment= 0.5 "Not low income" 3.Treatment= 0.5 "Not low income")) , bylabel("Income") || ///
		(Urban1, msymbol(o) ciopts(recast(. rcap) color(maroon maroon)) mcolor(maroon) mlabels(1.Treatment= 0.5 "Urban" 3.Treatment= 0.5 "Urban") mlabcolor(maroon)) ///
		(Urban2, msymbol(o) ciopts(recast(. rcap) color(navy navy)) mcolor(navy) mlabcolor(navy) mlabels(1.Treatment= 0.5 "Rural" 3.Treatment= 0.5 "Rural")) , bylabel("Urban or Rural") || ///
		(DFS_diverse1, msymbol(o) ciopts(recast(. rcap) color(maroon maroon)) mcolor(maroon) mlabels(1.Treatment= 0.5 "5 or more" 3.Treatment= 0.5 "5 or more") mlabcolor(maroon)) ///
		(DFS_diverse2, msymbol(o) ciopts(recast(. rcap) color(navy navy)) mcolor(navy) mlabcolor(navy) mlabels(1.Treatment= 0.5 "Less than 5" 3.Treatment= 0.5 "Less than 5")) , bylabel("Number of DFS used") || ///
		(ScamExp_81, msymbol(o) ciopts(recast(. rcap) color(maroon maroon)) mcolor(maroon) mlabels(1.Treatment= 0.5 "Been victim" 3.Treatment= 0.5 "Been victim") mlabcolor(maroon)) ///
		(ScamExp_82, msymbol(o) ciopts(recast(. rcap) color(navy navy)) mcolor(navy) mlabcolor(navy) mlabels(1.Treatment= 0.5 "Never victim" 3.Treatment= 0.5 "Never victim")) , bylabel("Scam Victim?") || , bycoef xline(0, lpattern(dash) lcolor(gs12)) levels(95 90) byopts(legend(off))  ciopts(recast(rcap rcap) color(navy navy)) mcolor(navy navy) mlabcolor(navy navy)  ///
		  keep(1.Treatment 3.Treatment) scheme(s1color) scale(0.9) subtitle(, size(medsmall) fcolor(white)) /*title("SIA")*/  aspectratio(1.8) 

graph export "$figures/figure2_panel1.png", replace

************************
**Panel 2: Confidence***
************************

coefplot (Female7, msymbol(o) ciopts(recast(. rcap) color(maroon maroon)) mcolor(maroon) mlabels(1.Treatment= 0.5 "Women" 3.Treatment= 0.5 "Women") mlabcolor(maroon)) ///
		(Female8, msymbol(o) ciopts(recast(. rcap) color(navy navy)) mcolor(navy) mlabcolor(navy) mlabels(1.Treatment= 0.5 "Men" 3.Treatment= 0.5 "Men")) , bylabel("Gender") ||   /// 
		(median_age7, msymbol(o) ciopts(recast(. rcap) color(maroon maroon)) mcolor(maroon) mlabels(1.Treatment= 0.5 "Above median (29+)" 3.Treatment= 0.5 "Above median (29+)") mlabcolor(maroon)) ///
		(median_age8, msymbol(o) ciopts(recast(. rcap) color(navy navy)) mcolor(navy) mlabels(1.Treatment= 0.5 "Below median (<29)" 3.Treatment= 0.5 "Below median (<29)")), bylabel("Age") || ///
		(PostSecondaryEducation7, msymbol(o) ciopts(recast(. rcap) color(maroon maroon)) mcolor(maroon) mlabels(1.Treatment= 0.5 "Post-secondary Education" 3.Treatment= 0.5 "Post-secondary Education") mlabcolor(maroon)) ///
		(PostSecondaryEducation8, msymbol(o) ciopts(recast(. rcap) color(navy navy)) mcolor(navy) mlabcolor(navy) mlabels(1.Treatment= 0.5 "Secondary or less" 3.Treatment= 0.5 "Secondary or less")) , bylabel("Education") || ///
		(LowIncome7, msymbol(o) ciopts(recast(. rcap) color(maroon maroon)) mcolor(maroon) mlabels(1.Treatment= 0.5 "Low Income" 3.Treatment= 0.5 "Low Income") mlabcolor(maroon)) ///
		(LowIncome8, msymbol(o) ciopts(recast(. rcap) color(navy navy)) mcolor(navy) mlabcolor(navy) mlabels(1.Treatment= 0.5 "Not low income" 3.Treatment= 0.5 "Not low income")) , bylabel("Income") || ///
		(Urban7, msymbol(o) ciopts(recast(. rcap) color(maroon maroon)) mcolor(maroon) mlabels(1.Treatment= 0.5 "Urban" 3.Treatment= 0.5 "Urban") mlabcolor(maroon)) ///
		(Urban8, msymbol(o) ciopts(recast(. rcap) color(navy navy)) mcolor(navy) mlabcolor(navy) mlabels(1.Treatment= 0.5 "Rural" 3.Treatment= 0.5 "Rural")) , bylabel("Urban or Rural") || ///
		(DFS_diverse7, msymbol(o) ciopts(recast(. rcap) color(maroon maroon)) mcolor(maroon) mlabels(1.Treatment= 0.5 "5 or more" 3.Treatment= 0.5 "5 or more") mlabcolor(maroon)) ///
		(DFS_diverse8, msymbol(o) ciopts(recast(. rcap) color(navy navy)) mcolor(navy) mlabcolor(navy) mlabels(1.Treatment= 0.5 "Less than 5" 3.Treatment= 0.5 "Less than 5")) , bylabel("Number of DFS used") || ///
		(ScamExp_87, msymbol(o) ciopts(recast(. rcap) color(maroon maroon)) mcolor(maroon) mlabels(1.Treatment= 0.5 "Been victim" 3.Treatment= 0.5 "Been victim") mlabcolor(maroon)) ///
		(ScamExp_88, msymbol(o) ciopts(recast(. rcap) color(navy navy)) mcolor(navy) mlabcolor(navy) mlabels(1.Treatment= 0.5 "Never victim" 3.Treatment= 0.5 "Never victim")) , bylabel("Scam Victim?") || ///	
		, bycoef xline(0, lpattern(dash) lcolor(gs12)) levels(95 90) byopts(legend(off))  ciopts(recast(rcap rcap) color(navy navy)) mcolor(navy navy) mlabcolor(navy navy)  ///
		  keep(1.Treatment 3.Treatment) scheme(s1color) scale(0.9) subtitle(, size(medsmall) fcolor(white)) /*title("Confidence")*/  aspectratio(1.8) 
graph export "$figures/figure2_panel2.png",replace



*******************************************************************************
*******************************************************************************
* FIGURE 3: Vignette-level effects by whether the message contains a scam marker
*******************************************************************************
*******************************************************************************

preserve
use "$datapath/online_survey_analysis_respondent_vignette_level", clear

eststo spec1: reg SIA_Correct_M i.Treatment##i.OrderSIA_Part2##i.Tips_apply $indiv_char ///
	, cluster(id2)
	
	
margins, at(OrderSIA_Part2 = 1 Tips_apply =(0 1) Treatment =(0 1))
mplotoffset, offset(.1) xscale(range(-.5 1.5)) yscale(range(0.5 0.9)) ylabel(0.5(0.1)0.9) recast(scatter) ///
ytitle("Share of correctly identified in Block 2")  xtitle("") title("All") ciopts(lwidth(medium)) legend(rows(1)) name(fig1_ind_controls,replace) 
	

eststo spec1: reg SIA_Correct_M i.Treatment##i.OrderSIA_Part2##i.Tips_apply $indiv_char  ///
	 if scam ==1 ///
	, cluster(id2)
	
margins, at(OrderSIA_Part2 = 1 Tips_apply =(0 1) Treatment =(0 1))
mplotoffset, offset(.1) xscale(range(-.5 1.5)) yscale(range(0.5 0.9)) ylabel(0.5(0.1)0.9) recast(scatter) ///
ytitle("Share of correctly identified in Block 2")  xtitle("") title("Scams") ciopts(lwidth(medium)) legend(rows(1)) name(fig2_ind_controls,replace) 
	
	
eststo spec1: reg SIA_Correct_M i.Treatment##i.OrderSIA_Part2##i.Tips_apply $indiv_char  ///
	if scam ==0 ///
	, cluster(id2)
	
margins, at(OrderSIA_Part2 = 1 Tips_apply =(0 1) Treatment =(0 1))
mplotoffset, offset(.1) xscale(range(-.5 1.5)) recast(scatter) ///
ytitle("Share of correctly identified in Block 2")  xtitle("") title("Non-scams") ciopts(lwidth(medium)) legend(rows(1)) name(fig3_ind_controls,replace) 
		
grc1leg  fig1_ind_controls fig2_ind_controls	fig3_ind_controls, rows(1) ycommon 

graph export "$figures/figure3.png" , replace width(1900) height(1000)

restore

*********************************************
*********************************************
* FIGURE A2: SIA and Confidence in Block 1
*********************************************
*********************************************

***************************************************************
**Panel 1: Distribution of scam identification ability (SIA)***
***************************************************************

hist SIA_share_Part1, percent disc ylabel(0(10)40, labsize(medium)) xlabel(,labsize(medium)) ///
	ytitle(,size(medium)) xtitle("",size(medium)) fcolor(white) 
graph export "$figures/figureA2_panel1.png", replace 	


***************************************************************
**Panel 2: Distribution of Confidence in SIA***
***************************************************************

hist SIA_confidence_Part1, percent disc ylabel(0(5)20, labsize(medium)) xlabel(,labsize(medium)) ///
	ytitle(,size(medium)) xtitle("",size(medium))  fcolor(white) 
	
graph export "$figures/figureA2_panel2.png", replace 	


*********************************************************************************
*********************************************************************************
* FIGURE D1: Vignette-level effects by whether the message contains a scam marker
*********************************************************************************
*********************************************************************************

preserve
use "$datapath/online_survey_analysis_respondent_vignette_level", clear

eststo spec1: reg SIA_Correct_M i.Treatment##i.OrderSIA_Part2##i.Tips_apply $indiv_char ///
	, cluster(id2)
	
	
margins, at(OrderSIA_Part2 = 1 Tips_apply =(0 1) Treatment =(0 3))
mplotoffset, offset(.1) xscale(range(-.5 1.5)) yscale(range(0.5 0.9)) ylabel(0.5(0.1)0.9) recast(scatter) ///
ytitle("Share of correctly classified in Block 2")  xtitle("") title("All") ciopts(lwidth(medium)) legend(rows(1)) name(fig1_ind_controls,replace) 
	

eststo spec1: reg SIA_Correct_M i.Treatment##i.OrderSIA_Part2##i.Tips_apply $indiv_char  ///
	 if scam ==1 ///
	, cluster(id2)
	
margins, at(OrderSIA_Part2 = 1 Tips_apply =(0 1) Treatment =(0 3))
mplotoffset, offset(.1) xscale(range(-.5 1.5)) yscale(range(0.5 0.9)) ylabel(0.5(0.1)0.9) recast(scatter) ///
ytitle("Share of correctly classified in Block 2")  xtitle("") title("Scams") ciopts(lwidth(medium)) legend(rows(1)) name(fig2_ind_controls,replace) 
	
	
eststo spec1: reg SIA_Correct_M i.Treatment##i.OrderSIA_Part2##i.Tips_apply $indiv_char  ///
	if scam ==0 ///
	, cluster(id2)
	
margins, at(OrderSIA_Part2 = 1 Tips_apply =(0 1) Treatment =(0 3))
mplotoffset, offset(.1) xscale(range(-.5 1.5)) recast(scatter) ///
ytitle("Share of correctly classified in Block 2")  xtitle("") title("Non-scams") ciopts(lwidth(medium)) legend(rows(1)) name(fig3_ind_controls,replace) 
		
grc1leg  fig1_ind_controls fig2_ind_controls	fig3_ind_controls, rows(1) ycommon 

graph export "$figures/figureD1.png" , replace width(1900) height(1000)

restore

*********************************************************************************
*********************************************************************************
* FIGURE D2: Vignette-level effects by difficulty of the vignette
*********************************************************************************
*********************************************************************************

preserve

use "$datapath/online_survey_analysis_respondent_vignette_level", clear


eststo spec1: reg SIA_Correct_M i.Treatment##i.OrderSIA_Part2##i.hard_task  $indiv_char ///
	, cluster(id2)
	
margins, at(OrderSIA_Part2 = 1 hard_task  =(0 1) Treatment =(0 1))
mplotoffset, offset(.1) xscale(range(-.5 1.5)) yscale(range(0.5 0.9)) ylabel(0.4(0.1)0.9) recast(scatter) ///
ytitle("Share of correctly identified in Block 2")  xtitle("") title("All") ciopts(lwidth(medium)) legend(rows(1)) name(fig1,replace) 
	

eststo spec1: reg SIA_Correct_M i.Treatment##i.OrderSIA_Part2##i.hard_task  $indiv_char ///
	 if scam ==1 ///
	, cluster(id2)
	
margins, at(OrderSIA_Part2 = 1 hard_task  =(0 1) Treatment =(0 1))
mplotoffset, offset(.1) xscale(range(-.5 1.5)) yscale(range(0.5 0.9)) ylabel(0.4(0.1)0.9) recast(scatter) ///
ytitle("Share of correctly identified in Block 2")  xtitle("") title("Scams") ciopts(lwidth(medium)) legend(rows(1)) name(fig2,replace) 

eststo spec1: reg SIA_Correct_M i.Treatment##i.OrderSIA_Part2##i.hard_task $indiv_char  ///
	if scam ==0 ///
	, cluster(id2)
			
margins, at(OrderSIA_Part2 = 1 hard_task =(0 1) Treatment =(0 1))
mplotoffset, offset(.1) xscale(range(-.5 1.5)) recast(scatter) ylabel(0.4(0.1)0.9) ///
ytitle("Share of correctly identified in Block 2")  xtitle("") title("Non-scams") ciopts(lwidth(medium)) legend(rows(1)) name(fig3,replace) 
		
grc1leg  fig1 fig2	fig3, rows(1) ycommon 

graph export "$figures/figureD2.png" , replace width(1900) height(1000)

restore

